package com.querie.sql;

import java.sql.Connection;
import java.sql.SQLException;

import com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource;

public class ConnectionFactory {

	private static Connection conn; 
	
	static {
		
		MysqlConnectionPoolDataSource ds = new MysqlConnectionPoolDataSource();
	    ds.setUser(DBConfig.getUser());
	    ds.setPassword(DBConfig.getPassword());
	    ds.setUrl(DBConfig.getUrl());
	    try {
			conn = ds.getConnection();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
	public static Connection getConnection() throws SQLException{
	    
	    return conn; 
  }
 
}
